<?php

/**
 * Boleto form base class.
 *
 * @method Boleto getObject() Returns the current form's model object
 *
 * @package    SistemaRutasEc
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseBoletoForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id_bo'   => new sfWidgetFormInputHidden(),
      'id_tu'   => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Turno'), 'add_empty' => false)),
      'dni'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Persona'), 'add_empty' => false)),
      'destino' => new sfWidgetFormInputText(),
      'origen'  => new sfWidgetFormInputText(),
      'estado'  => new sfWidgetFormInputText(),
      'valor'   => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id_bo'   => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id_bo')), 'empty_value' => $this->getObject()->get('id_bo'), 'required' => false)),
      'id_tu'   => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Turno'))),
      'dni'     => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Persona'))),
      'destino' => new sfValidatorString(array('max_length' => 50, 'required' => false)),
      'origen'  => new sfValidatorString(array('max_length' => 3)),
      'estado'  => new sfValidatorString(array('max_length' => 3)),
      'valor'   => new sfValidatorNumber(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('boleto[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Boleto';
  }

}
